#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    : 2023/11/28 23:24
# @function: the script is used to do something.
# @version : 


from lxml import etree

text = ''' <div> <ul> 
        <li class="item-1"><a></a></li> 
        <li class="item-1"><a href="link2.html">second item</a></li> 
        <li class="item-inactive"><a href="link3.html">third item</a></li> 
        <li class="item-1"><a href="link4.html">fourth item</a></li> 
        <li class="item-0"><a href="link5.html">fifth item</a> 
        </ul> </div> '''


html = etree.HTML(text)

li_list = html.xpath("//li[@class='item-1']")
for li in li_list:
    print(li.xpath('./a/text()'))

